<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('诊疗单列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="formId">
				<div class="select-list">
					<ul>
						<li>
							鸡舍号：<input type="text" id="roomNum" name="roomNum"/>
						</li>
						<li>
							状态：
							<select name="zlStatus">
								<option value="">所有</option>
								<option value="1">待确认</option>
								<option value="3">已确认</option>
								<option value="4">已生成订单</option>
								<option value="5">待发送</option>
							</select>

						</li>
						<li class="select-time">
							<label>日期： </label>
							<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginzlTime]" lay-key="1">
							<span>-</span>
							<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endzlTime]" lay-key="2">
						</li>

						<!--<li>
                            备注：<input type="text" name="remark"/>
                        </li>
-->
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ncChickenZhenliaoLogs:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ncChickenZhenliaoLogs:edit">
				<i class="fa fa-edit"></i> 修改
			</a>
			<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ncChickenZhenliaoLogs:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
			<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncChickenZhenliaoLogs:export">
				<i class="fa fa-download"></i> 导出
			</a>-->
			<a class="btn btn-warning" onclick="$.operate.confirmEnter()">
				<i class="fa fa-send"></i> 发送
			</a>
		</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncChickenZhenliaoLogs:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncChickenZhenliaoLogs:remove')}]];
    var detailFlag = [[${@permission.hasPermi('system:ncChickenZhenliaoLogs:detail')}]];
    var prefix = ctx + "system/ncChickenZhenliaoLogs";
	$(function() {
        var options = {
          url: prefix + "/list?zlType="+2,
			createUrl: prefix + "/add",
           detailUrl: prefix + "/detail/{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            confirmUrl:prefix + "/confirmTable",
            modalName: "诊疗单",
            showExport: true,
            sortName:'createTime',
            sortOrder:'desc',

            columns: [{
                checkbox: true
            },
                {
                    field : 'zlId',
                    title : '诊疗id',
                    visible: false
                },
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },
                {
                    field : 'roomNum',
                    title : '鸡舍号',
                    sortable: true
                },
                {
                    field : 'illMuns',
                    title : ' 发病次数',
                    sortable: true
                },
                {
                    field : 'symptom',
                    title : '症状',
                    sortable: true
                },
                {
                    field : 'zlStatus',
                    title : '状态:',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (1 == value) {
                            return "待确认"
                        }
                        else if (3 == value) {
                            return "已确认"
                        }
                        else if (4 == value) {
                            return "已生成订单"
                        }
                        else if (5 == value) {
                            return "待发送"
                        }
                        return "--";

                    }
                },
                {
                    field : 'createTime',
                    title : '请求时间',
                    sortable: true

                },

                {
                    field : 'remark',
                    title : '备注',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.zlStatus == 1 || row.zlStatus == 5){
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.zlId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.zlId + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                        else if(row.zlStatus == 3 || row.zlStatus == 4){
                            actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.zlId + '\')"><i class="fa fa-search"></i>详细</a> ');
                            return actions.join('');
                        }

                    }
                }]
    };
        $.table.init(options);
    });
    /*function detail(zlId){
        var url = prefix + '/detail/'+zlId;

        $.modal.openTab("兽医请求详情单", url);
    }*/
    setTitle("鸡舍管理-兽医请求",true)
</script>
</body>
</html>